package com.buba.system.dao.impl;

import com.buba.system.dao.RoleDao;
import com.buba.system.pojo.Role;
import com.buba.util.DBPool;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

public class RoleDaoImpl implements RoleDao {
    QueryRunner queryRunner = new QueryRunner(DBPool.getDS());
    @Override
    public List<Role> selRole() {
        String sql = "select * from roleinfo";
        try {
            List<Role> query = queryRunner.query(sql, new BeanListHandler<Role>(Role.class));
            return query;
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }
}
